package org.xm.sk.vo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.xm.sk.vo.e.Datalevel;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@MappedSuperclass
@Data
@ApiModel(value = "Base", description = "基础")
public class Base implements IBaseVO<Integer> {

    /**
     * 
     */
    private static final long serialVersionUID = -8464391730469871795L;

    @ApiModelProperty(value = "编号")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(unique = true, nullable = false)
    private Integer id;

    @ApiModelProperty(value = "作者编号")
    @Column
    private Integer creator = 1;

    @ApiModelProperty(value = "作者")
    @Column
    private String creatorName;

    @ApiModelProperty(value = "修改者编号")
    @Column
    private Integer editer = 1;

    @ApiModelProperty(value = "修改者")
    @Column
    private String editerName;

    @ApiModelProperty(value = "创建时间")
    @Temporal(TemporalType.TIMESTAMP)
    @Column
    private Date createdate = new Date();

    @ApiModelProperty(value = "修改时间")
    @Temporal(TemporalType.TIMESTAMP)
    @Column
    private Date modifydate = new Date();

    @ApiModelProperty(value = "数据级别")
    @Enumerated(value = EnumType.ORDINAL)
    @Column
    private Datalevel datalevel = Datalevel.NORMAL;

    @ApiModelProperty(value = "备注")
    @Column
    private String memo;

    public static boolean isValid(Base base) {
        if (null != base && null !=  base.getId() && 0 < base.getId())
            return true;
        else
            return false;
    }
    
}
